import type { AddressItem } from '@/types/global'
import { defineStore } from 'pinia'
import { ref } from 'vue'

// 定义 Store
export const useAddressStore = defineStore(
    'address',
    () => {
        /** 订单页面选择的地址 */
        const selectedAddress = ref<AddressItem>()

        /** 切换选中的地址 */
        const selectedChange = (val: AddressItem) => {
            selectedAddress.value = val
        }
        return {
            selectedAddress,
            selectedChange
        }
    }
)
